package com.forum.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.forum.dao.DisciplinetabDao;
import com.forum.entity.DisciplinetabEntity;
import com.forum.entity.view.DisciplinetabView;
import com.forum.service.DisciplinetabService;
import com.forum.utils.MyQuery;
import com.forum.utils.PageUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 张继成
 * @since 2023-12-31
 */
@Service
public class DisciplinetabServiceImpl extends ServiceImpl<DisciplinetabDao, DisciplinetabEntity> implements DisciplinetabService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<DisciplinetabEntity> page = this.selectPage(
                new MyQuery<DisciplinetabEntity>(params).getPage(),
                new EntityWrapper<DisciplinetabEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<DisciplinetabEntity> wrapper) {
        Page<DisciplinetabView> page =new MyQuery<DisciplinetabView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    /*@Override
    public List<XuekeVO> selectListVO(Wrapper<DisciplinetabEntity> wrapper) {
        return baseMapper.selectListVO(wrapper);
    }

    @Override
    public XuekeVO selectVO(Wrapper<DisciplinetabEntity> wrapper) {
        return baseMapper.selectVO(wrapper);
    }*/

    @Override
    public List<DisciplinetabView> selectListView(Wrapper<DisciplinetabEntity> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public DisciplinetabView selectView(Wrapper<DisciplinetabEntity> wrapper) {
        return baseMapper.selectView(wrapper);
    }

}
